IF exists(SELECT * FROM dbo.sysobjects WHERE name='hulpKlasnaam' AND xtype='FN') 
BEGIN
	DROP FUNCTION hulpKlasnaam
END
GO

create function hulpKlasnaam
(@iNr varchar(20))
returns varchar(20)
as
begin
  declare @klas varchar(20)
  select @klas = klas from leerlingen..leerlingen where inschrijvingsNr = @iNr
  return (@klas)
end